# @Time : 2021/3/5 13:34
# @Author : Fioman 
# @Phone : 13149920693
import cv2 as cv
import numpy as np


def image_show(name, image, time, showState=False):
    """
    显示图像,调试的时候使用,根据一定的比率进行缩放. 调试的时候可以将if False,改成if True
    :param name:
    :param image:
    :param time:
    :param showState:
    :return:
    """
    if True:
        rate = 2
        width, height = int(image.shape[1] / rate), int(image.shape[0] / rate)
        showImage = cv.resize(image, (width, height), interpolation=cv.INTER_AREA)
        cv.namedWindow(name, cv.WINDOW_AUTOSIZE)
        cv.imshow(name, showImage)
        cv.waitKey(0)


imageSrc = cv.imread("screen.jpg",cv.IMREAD_COLOR)
image_show("Src",imageSrc,0,True)

imageFlip = cv.flip(imageSrc,1)
image_show("Flip",imageFlip,0,True)

cv.imwrite("flip.jpg",imageFlip)

